﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace UI
{
    /// <summary>
    /// Login.xaml 的交互逻辑
    /// </summary>
    public partial class Login : Window
    {
        public Login()
        {
            InitializeComponent();
        }

        private void Btn_LoginClick(object sender, RoutedEventArgs e)
        {
            Model.DataContext context = new Model.DataContext();

            var user = context.DB.Queryable<Model.U_User>().Where(u => u.Name == txt_userName.Text && u.Password == txt_Password.Password).First();
            if (user == null)
            {
                HandyControl.Controls.Growl.WarningGlobal("用户名或密码错误！");
            }
            else
            {


                Comm.TempData.LoginUser = user;
                MainWindow window = new MainWindow();
                window.Show();

                this.Close();
            }
        }

      
    }
}
